package main

import (
	"fmt"
	"runtime"
	"strconv"
	"time"
)

func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())
	c := make(chan int, 4)
	for i := 0; i < 5; i++ {
		go func(i int) {
			fmt.Println("传递" + strconv.Itoa(i))
			fmt.Println(<-c)
		}(i)
		time.Sleep(1 * time.Second)
		c <- i
	}

}
